import 'package:flutter/material.dart';
import './myFonts.dart';

//ListView列表组件
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('ListView列表组件 '),
          backgroundColor: Colors.pink[50],
        ),
        body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.all(10),
      children: [
        Container(
          height: 120,
          width: 20, //垂直列表宽度自适应 不生效
          decoration: BoxDecoration(color: Colors.pink[100]),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(color: Colors.blue[100]),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(color: Colors.green[100]),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(color: Colors.red[100]),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(
            color: const Color.fromARGB(255, 214, 48, 214),
          ),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(
            color: const Color.fromARGB(255, 187, 221, 248),
          ),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(color: Colors.green[100]),
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(color: Colors.red[100]),
        ),
      ],
    );
  }
}
